<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="/assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="/assets/css/common.css">
    <link rel="stylesheet" href="/assets/css/css.css">
    <title>订单列表</title>
</head>
<body>
    <section>
    	{if $orderList.orderList|@count >0}
        <table class="table table-bordered">
            <thead>
                <tr>
                    <td>订单号</td>
                    <td>总金额</td>
                    <td>实收款</td>
                </tr>
            </thead>
            <tbody>
				{foreach from=$orderList.orderList item=order}
				{if $order.needPay gt 0}
				<tr><td>{$order.order_num}</td><td>{$order.total}</td><td>{$order.needPay}</td></tr>
				{/if}
				{/foreach}
                <tr><td colspan="2">合计</td><td>{$orderList.total}</td></tr>
            </tbody>
        </table>
        <div style="text-align: center;"><button class="btn btn-success btn-lg account-for" type="button">确定交账</button></div>
    {else}
    		<div>没有需要交账的订单</div>
    {/if}
    </section>
    <script src="/assets/js/jquery-1.10.2.min.js"></script>
    <script src="/assets/js/jquery.mobile.custom.js"></script>
    <script src="/assets/js/bootstrap.min.js"></script>
    <script src="/assets/js/public.js"></script>
    {literal}
    <script type="text/javascript">
		$(function(){
			$(".account-for").on('tap',function(e){
				e.stopPropagation();
                e.preventDefault();
				if(confirm("确定交账吗？")){
					$.ajax({
						type:"get",
						url:"/api/pay/account_for_commpany/",
						async:true,
						dataType:"json",
						success:function(data){
							alert(data.errorMessage);
							location.href = location.href;
							return false;
						}
					});
				}
			});			
		});
    </script>
    {/literal}
</body>
</html>